package net.ifilm.service;

import net.ifilm.common.IFilmException;
import net.ifilm.dao.FilmScoreDao;
import net.ifilm.dao.FilmTypeDao;
import net.ifilm.entity.FilmScore;
import net.ifilm.entity.FilmType;
import net.ifilm.entity.PageCount;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 *
 */
@Component
public class FilmScoreService {

    @Autowired
    public FilmScoreDao filmScoreDao;

    // ------------------------------------------------------------------------------------------------ public method

    /**
     * 添加电影评分
     *
     * @param filmScore
     * @return
     */
    public void addFilmScore(FilmScore filmScore) {
        filmScoreDao.insertFilmSocre(filmScore);
    }

    /**
     * 查询电影平均分
     *
     * @param filmId
     * @return
     */
    public double findAvgScore(int filmId) {
        return filmScoreDao.queryAvgScore(filmId);
    }

    /**
     * 查询电影评分基数
     *
     * @param filmId
     * @return
     */
    public int findScoreCount(int filmId) {
        return filmScoreDao.queryScoreCount(filmId);
    }

} ///:~
